<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head>
    <base href="<%=basePath%>" />
    <title>Shared Area Information Validate Management</title>
    <script type="text/javascript">
		var path = "<%=basePath%>";
	</script>
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
	<meta http-equiv="description" content="This is my page" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>beshs/css/content.css" />
	<link type="text/css" href="<%=basePath%>beshs/css/frame_style.css" rel="stylesheet" />
	<link type="text/css" href="<%=basePath%>beshs/css/element_style.css" rel="stylesheet" />
	<script type="text/javascript" src="<%=basePath%>resources/jquery/jquery-1.7.2.min.js"></script>
	<!-- 系统通用资源 -->
	<jsp:include page="/resources/resource-refer/common-resource-reference.jsp" />
	<!-- iframe高度自适应 -->
	<script type="text/javascript">
        function getOsName() { 
    		var OsObject = ""; 
		   	if(navigator.userAgent.indexOf("MSIE")>0) { 
		    	return "MSIE"; 
		   	} 
		   	if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
		        return "Firefox"; 
		   	} 
		   	if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
		        return "Safari"; 
		   	}  
		  	if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
		        return "Camino"; 
		   	} 
		   	if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 
		        return "Gecko"; 
		   	} 
		} 
        
        /** 根据浏览器类型选择iframe自适应方式 **/
        function setIframeHeightAutosize() {
        	//获取Iframe对象 ie和firefox都可以获得
        	var veriIframe = document.getElementById("infoVeriPage"); 
        	try{
                if(getOsName() == 'MSIE'){
                    var lbHeight = veriIframe.document.body.scrollHeight; //IE
                    veriIframe.style.height =  lbHeight + "px"; 
                }else if(getOsName() == 'Firefox'){
                    var lfHeight = veriIframe.contentDocument.body.scrollHeight; //FireFox 
                    veriIframe.height = lfHeight + "px";   
                } else {
                    veriIframe.style.height = 400 + "px";
                }          
            } catch (ex){}
		}
		
		$(function() {
			setIframeHeightAutosize();
		})
    </script>
  </head>
  <body>
  	<div class="content_all">
  		<!--导航条-->
  		<div class="insertinfo_table">
		  	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		    	<tr>
		        	<th>Shared Area：</th>
		          	<td><s:property value='shareArea.areaName' /></td>
		            <th>Allocation Name：</th>
		          	<td><s:property value='shareAreaResult.shareName' /></td>
		          	<th>Allocation Method：</th>
		        	<td>
		        		<s:if test="shareAreaResult.shareType==1">Process Allocation</s:if>
		        		<s:if test="shareAreaResult.shareType==2">Charge Allocation</s:if>
		        	</td>
		        </tr>
		        <tr>
		        	<th>Allocation Period Start Date：</th>
		        	<td>
		        		<s:date name='shareAreaResult.startDate' format='yyyy-MM-dd' nice='false' />
		        	</td>
		        	<th>Allocation Period End Date：</th>
		        	<td>
		        		<s:date name='shareAreaResult.endDate' format='yyyy-MM-dd' nice='false' />
		        	</td>
		        	<th></th>
		        	<td></td>
		        </tr>
		        <tr>
		        	<th>Question Description：</th>
		        	<td colspan="5" style="white-space: normal;">
		        		<s:property value="illegalVerifyInfo" />
		        		<span style="color:FF0000;">
		        			<s:if test="infoSort == 'heatMeterData'">
		        				<s:if test="meterNoList.length() > 0">
		        					Prompt：please check the follow heat meter data completely：<br/>
		        					<s:if test="meterNoList.split(',').length > 5">
		        						<s:iterator var="meterNo" value="meterNoList.split(',')" status="status" >
		        							<s:property value='#meterNo' />
		        							<s:if test="(#status.index+1)%5 == 0">
		        								<br/>
		        							</s:if>
		        							<s:elseif test="#status.index < meterNoList.split(',').length-1">
		        								,
		        							</s:elseif>
		        						</s:iterator>
		        					</s:if>
		        					<s:else>
		        						<s:property value='meterNoList' />
		        					</s:else>
		        				</s:if>
		        			</s:if>
		        			<s:if test="infoSort == 'assignMeterData'">
		        				<s:if test="roomOwnerList.length() > 0">
		        					Prompt：please check the follow heat user has allocator information：<br/>
		        					<s:if test="roomOwnerList.split(',').length > 5">
		        						<s:iterator var="roomOwner" value="roomOwnerList.split(',')" status="status" >
		        							<s:property value='#roomOwner' />
		        							<s:if test="(#status.index+1)%5 == 0">
		        								<br/>
		        							</s:if>
		        							<s:elseif test="#status.index < roomOwnerList.split(',').length-1">
		        								,
		        							</s:elseif>
		        						</s:iterator>
		        					</s:if>
		        					<s:else>
		        						<s:property value='roomOwnerList' />
		        					</s:else>
		        				</s:if>
		        				<s:if test="seriousNumList.length() > 0">
		        					Prompt：please check the follow allocator data completely：<br/>
		        					<s:if test="seriousNumList.split(',').length > 5">
		        						<s:iterator var="seriousNum" value="seriousNumList.split(',')" status="status" >
		        							<s:property value='#seriousNum' />
		        							<s:if test="(#status.index+1)%5 == 0">
		        								<br/>
		        							</s:if>
		        							<s:elseif test="#status.index < seriousNumList.split(',').length-1">
		        								,
		        							</s:elseif>
		        						</s:iterator>
		        					</s:if>
		        					<s:else>
		        						<s:property value='seriousNumList' />
		        					</s:else>
		        				</s:if>
		        			</s:if>
		        		</span>
		        	</td>
		        </tr>
		        <tr>
          			<td style="border:none" colspan="6" align="center">
          				<script type="text/javascript">
          					/**
          					 * 数据平滑处理
          					 */
          					function transitionMeterData(infoSort, shareAreaUID, startDate, endDate) {
          						Dialog.confirm("Data smoothing need much time，please wait patient！", function() {
          							$.getJSON(path+"beshs/shareAreaResultActionJson!transitionMeterData.do?date="+new Date(), {
          								infoSort: infoSort,
          								shareAreaUID: shareAreaUID,
          								startDate: startDate,
          								endDate: endDate
          							}, function(data) {
          								if(data.success) {
          									Dialog.alert("Successful Operation", function() {
          										window.frames["infoVeriPage"].location = path + "beshs/shareAreaResultAction!queryAreaResultInfoListBySort.do?infoSort="+infoSort 
		    											+ "&shareAreaUID=" + shareAreaUID 
		    											+ "&illegalIDList=''"
		    											+ "&date=" + new Date();
          									});
          								} else {
          									Dialog.alert(data.msg);
          								}
          							});
          						});
          					}	
          				
          					$(function() {
          						$("input[name='dataTransition']").click(function() {
          							var infoSort = "<s:property value='infoSort' />";
          							var illegalIDList = "<s:property value='illegalIDList' />";
          							//分摊信息
          							var shareAreaUID = "<s:property value='shareArea.id' />";
          							var startDate = "<s:date name='shareAreaResult.startDate' format='yyyy-MM-dd' nice='false' />";
          							var endDate = "<s:date name='shareAreaResult.endDate' format='yyyy-MM-dd' nice='false' />";
          							//没有校验失败的数据才可执行数据平滑
          							if(infoSort == "heatMeterData") { //热量表数据的数据平滑
          								if(illegalIDList.length == 0) { 
          									transitionMeterData(infoSort, shareAreaUID, startDate, endDate);
          									return;
          								}
          							} 
          							if(infoSort == "assignMeterData") { //分配表数据的数据平滑
          								if(illegalIDList.length == 0) {
          									transitionMeterData(infoSort, shareAreaUID, startDate, endDate);
          									return;
          								}
          							}
          							Dialog.alert("The data is not fit for smoothing，please begin to smooth data after modifying the data!");
          						});
          						
          						$("input[name='goBack']").click(function() {
          							window.location = path + "beshs/shareAreaResultAction!queryAreaResultPage.do?date="+new Date();
          						});
          					});
          				</script>
          				<input name="dataTransition" type="reset" value="Data Smoothing" class="s_btn"/>
            			<input name="goBack" type="reset" value="Return" class="s_btn"/></td>
        		</tr>		
		    </table>
		</div>
	</div>
	<div class="clear"></div>
  	<table cellpadding="0" class="frame_right" cellspacing="0" border="0" height="100%" width="100%">
  		<tr>
  			<td>
  			<!-- 根据校验信息类别导航对应的更正页面 -->
  				<script type="text/javascript">
  					$(function() {
  						var infoSort = "<s:property value='infoSort' />";
  						var shareAreaUID = "<s:property value='shareArea.id' />";
  						var illegalIDList = "<s:property value='illegalIDList' />";
  	  					//热用户信息更正页面
  	  					if(infoSort == "heatRoom") {
  	  						window.frames["infoVeriPage"].location = path + "beshs/shareAreaResultAction!queryAreaResultInfoListBySort.do?infoSort=heatRoom" 
  	  								+ "&shareAreaUID=" + shareAreaUID 
  	  								+ "&illegalIDList=" + illegalIDList 
  	  								+ "&date=" + new Date();
  	  					}
  	  					//热量表数据更正页面
  	  					if(infoSort == "heatMeterData") {
  	  						window.frames["infoVeriPage"].location = path + "beshs/shareAreaResultAction!queryAreaResultInfoListBySort.do?infoSort=heatMeterData" 
									+ "&shareAreaUID=" + shareAreaUID 
	  								+ "&illegalIDList=" + illegalIDList 
	  								+ "&date=" + new Date();
  	  					}
  	  					//分配表数据更正页面
  	  					if(infoSort == "assignMeterData") {
  	  						window.frames["infoVeriPage"].location = path + "beshs/shareAreaResultAction!queryAreaResultInfoListBySort.do?infoSort=assignMeterData" 
									+ "&shareAreaUID=" + shareAreaUID 
									+ "&illegalIDList=" + illegalIDList 
									+ "&date=" + new Date();
  	  					}
  					});
  				</script>
  				<iframe frameborder="0" scrolling="auto" name="infoVeriPage" id="infoVeriPage" src="<%=basePath%>common/empty.jsp" height="100%" width="100%"></iframe>
  			</td>
  		</tr>
  	</table>
  </body>
</html>
